﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <style type ="text/css" >
        .InfoHeader
        {
            width:100%;
            height:20px;
            background-color:lightBlue;
            border:solid 1px blue;
        }
        .InfoBody
        {
            width:100%;
            height:100px;
        }
    </style>
</head>
<body>
     <div>
        <div class ="InfoHeader">
            系统消息：
        </div>
        <div class="InfoBody" id="InfoBodyDiv">
        </div>
     </div>
     <script type="text/javascript" >
         document.title = "系统消息";
         window.onload = function() {
             init();
         }
         function init() {
             var totalInfoStr = "";
             var info = getQueryString("info");
             var infoArgs = info.split(",");
             if (infoArgs.length >= 2) {
                 for (var i = 0; i < infoArgs.length / 2; i++) {
                     var userid = infoArgs[2 * i];
                     var type = infoArgs[2 * i + 1];
                     var typeStr = "";
                     if (type == 0)
                         typeStr = "下线了";
                     else if (type == 1)
                         typeStr = "注册了";
                     else if (type == 2)
                         typeStr = "上线了";
                     else if (type == 3)
                         typeStr = "注册了并在线上";
                     else
                         typeStr = "";
                     if (typeStr != "") {
                         var infoStr = "<span>好友：" + userid + typeStr + "！</span><br/>";
                         totalInfoStr += infoStr;
                     }
                     else {
                         if (type == -1) {
                             var infoStr = "<span>好友：" + userid +   "给您发送新消息！</span><br/>";
                             totalInfoStr += infoStr;
                         }
                     }
                 }
             }
             document.getElementById("InfoBodyDiv").innerHTML = totalInfoStr;
         }
         function getQueryString(queryName) {
             var queryValue = "";
             var queryFound = false;
             if (window.location.search != "") {
                 var search = window.location.search;
                 var i = 0;
                 while (i <= search.length) {
                     start = i;
                     end = start + queryName.length;
                     if (search.substring(start, end) == queryName) {
                         queryFound = true;
                         break;
                     }
                     i++;
                 }
                 if (queryFound) {
                     start = end + 1;
                     end = search.indexOf("&", start);
                     if (end < start)
                         end = search.length;
                     var getvalue = search.substring(start, end);
                     return unescape(getvalue);
                 }
             }
             return queryValue;
         }
     </script>
</body>
</html>
